package com.ndp.fb.enums.targetingspec;

import lombok.Getter;

/**
 * Created by Sisi on 14-12-24.
 */
@Getter
public enum RelationShipStatusType {

    SINGLE(1, "single", "Single"),

    IN_RELATIONSHIP(2, "in_relationship", "In a Relationship"),

    MARRIED(3, "married", "Married"),

    ENGAGED(4, "engaged", "Engaged"),

    NOT_SPECIFIED(6, "not specified", "Not specified"),

    IN_A_CIVIL_UNION(7, "in a civil union", "in a civil union"),

    IN_A_DOMESTIC_PARTNERSHIP(8, "in a domestic partnership", "in a domestic partnership"),

    IN_AN_OPEN_RELATIONSHIP(9, "In an open relationship", "In an open relationship"),

    IT_COMPLICATED(10, "It's complicated", "It's complicated"),

    SEPARATED(11, "Separated", "Separated"),

    DIVORCED(12, "Divorced", "Divorced"),

    WIDOWED(13, "Widowed", "Widowed");

    private int code;

    private String fbRelationShipStatus;

    private String localRelationShipStatus;

    RelationShipStatusType(int code, String fbRelationShipStatus, String localRelationShipStatus) {
        this.code = code;
        this.fbRelationShipStatus = fbRelationShipStatus;
        this.localRelationShipStatus = localRelationShipStatus;
    }

    /**
     * 根据code获取RelationShipStatus
     *
     * @param code code
     * @return RelationShipStatus
     */
    public static RelationShipStatusType getRelationShipStatus(int code) {
        for (RelationShipStatusType c : RelationShipStatusType.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }
}
